package com.cwl.base.day04.string;

/**
 * @program: java_base
 * @description:
 * @author: ChenWenLong
 * @create: 2019-11-07 20:02
 **/
public class TestStringBuilder {

    public static void main(String[] args) {
        StringBuilder sb = new StringBuilder();   //字符数组长度初始为16
        StringBuilder sb1 = new StringBuilder(32);   //字符数组长度初始为32
        StringBuilder sb2 = new StringBuilder("abcd");   //字符数组长度初始为32, value[]={'a','b','c','d',\u0000,\u0000...}
        sb2.append("efg");
        sb2.append(true).append(321).append("随便");   //通过return this实现方法链.

        System.out.println(sb2);

        System.out.println("##################");

        StringBuilder gh = new StringBuilder("a");
        for (int i = 0; i < 1000; i++) {
            gh.append(i);
        }
        System.out.println(gh);

        StringBuilder sb4 = new StringBuilder("abcdefghijklmnopqrstuvwxyz");
        sb.delete(3, 5).delete(3, 5);   //结果：abchijklmnopqrstuvwxyz
        System.out.println(sb);
        sb.reverse();
        System.out.println(sb);

        StringBuffer sb3 = new StringBuffer();


    }
}
